package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Tag;
import cn.wolfcode.trip.base.mapper.TagMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ITagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagServiceImpl implements ITagService {
    @Autowired
    private TagMapper tagMapper;
    @Override
    public void insert(Tag tag) {
        tagMapper.insert(tag);
    }

    @Override
    public Tag selectByTagName(Tag tag) {
        Tag tag1 = tagMapper.selectByTagName(tag);
        if(tag1 == null){
            return null;
        }else {
            return tag1;
        }
    }

    @Override
    public void insertRelation(Long commentId, Long tagId) {
        tagMapper.insertRelation(commentId,tagId);
    }

    @Override
    public List<Tag> selectByStrategyId(QueryObject qo) {
        return tagMapper.selectByStrategyId(qo);
    }

    @Override
    public void insertStrategyRelation(Long strategyId, Long tagId) {
        tagMapper.insertStrategyRelation(strategyId,tagId);
    }
}
